<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<script type="text/javascript">
    function pay() {
        function onBridgeReady(){

            WeixinJSBridge.invoke(
                'getBrandWCPayRequest', {
                    "appId":"${result.appId}",     //公众号名称，由商户传入
                    "timeStamp":"${result.timeStamp}",         //时间戳，自1970年以来的秒数
                    "nonceStr":"${result.nonceStr}", //随机串
                    "package":"${result['package']}",
                    "signType":"${result.signType}",         //微信签名方式：
                    "paySign":"${result.paySign}" //微信签名
                },
                function(res){
                    if(res.err_msg == "get_brand_wcpay_request:ok" ){
                        alert('课程预约成功');
                        window.location.href="/order"
                        // 使用以上方式判断前端返回,微信团队郑重提示：
                        //res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                    }else if(res.err_msg == "get_brand_wcpay_request:cancel"){
                        console.log('支付取消');
                    }else if(res.err_msg == "get_brand_wcpay_request:fail"){
                        console.log('支付失败');
                        WeixinJSBridge.call('closeWindow');
                    }
                });
        }
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        }else{
            onBridgeReady();
        }
    }
</script>

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/public/logo.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/public/css/font.css">
    <link rel="stylesheet" href="/public/css/xadmin.css">

</head>
<body>
<div class="x-body layui-anim layui-anim-up">
    <blockquote class="layui-elem-quote">订单信息
        <br>
        <span class="x-red"></span>课程名称: ${list[0].cname}
        <br>
        <span class="x-red"></span>老师: ${list[0].cteacher}
        <br>
        <span class="x-red"></span>上课时间: ${list[0].ctime}
    </blockquote>

    <fieldset class="layui-elem-field">
        <legend>激活方式</legend>
        <div class="layui-field-box">
            <table class="layui-table" lay-skin="line">
                <tbody>
                <tr>
                    <td >
                        <a>1.付款1元立即激活</a>
                    </td>
                </tr>
                <tr>
                    <td >
                        <a href="">2.邀请2名新用户关注本公众号即可激活</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </fieldset>

    <fieldset class="layui-elem-field">
        <legend>立即激活</legend>
        <div class="layui-field-box">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div class="layui-carousel x-admin-carousel x-admin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 160px;">
                            <div carousel-item="">
                                <ul class="layui-row layui-col-space10 layui-this">


                                    <li class="layui-col-sm2">
                                        <a onclick="pay()" class="x-admin-backlog-body">
                                            <h3></h3>
                                            <p>
                                                <cite>付款1元</cite></p>
                                        </a>
                                    </li>
                                    <li class="layui-col-sm2">
                                        <a href="/qrcode" class="x-admin-backlog-body">
                                            <h3></h3>
                                            <p>
                                                <cite>邀请新用户</cite></p>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </fieldset>


</div>
</body>
</html>